package com.assignwork.service.impl;

import com.assignwork.dto.CorpTeamSearchDTO;
import com.assignwork.dto.CorpTeamSubmitDTO;
import com.assignwork.entity.CorpTeam;
import com.assignwork.mapper.CorpTeamMapper;
import com.assignwork.service.ICorpTeamService;
import com.assignwork.vo.CorpTeamListVO;
import com.assignwork.vo.CorpTeamMachineStatusVO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName CorpTeamServiceImpl
 * @Description
 * @Author dujianyu
 * @Date 2023/12/12 13:51
 */
@Service
public class CorpTeamServiceImpl extends BaseServiceImpl<CorpTeamMapper, CorpTeam> implements ICorpTeamService {
    @Override
    public IPage<CorpTeamListVO> selectCorpTeamPage(CorpTeamSearchDTO dto, IPage<CorpTeamListVO> page) {
        List<CorpTeamListVO> data = baseMapper.selectCorpTeamList(dto, page);
        return page.setRecords(data);
    }

    @Override
    public List<CorpTeamListVO> selectCorpTeamList(CorpTeamSearchDTO dto) {
        return baseMapper.selectCorpTeamList(dto, null);
    }

    @Override
    public boolean submitCorpTeam(CorpTeamSubmitDTO dto) {
        CorpTeam entity = BeanUtil.copy(dto, CorpTeam.class);
        return super.saveOrUpdate(entity);
    }

    @Override
    public List<CorpTeamMachineStatusVO> selectMachineStatusList(CorpTeamSearchDTO dto) {
        return baseMapper.selectMachineStatusList(dto);
    }
}
